The TUnitData Structure
You use theTUnitData
structure to describe the data being sent with theOTSndUData
function (page 3-101) and the data being read with theOTRcvUData
function (page 3-105); you pass this structure as a parameter to each of these functions.The
TUnitData
structure is defined by theTUnitData
type.
struct TUnitData { TNetbuf addr; TNetbuf opt; TNetbuf udata; }; typedef struct TUnitData TUnitData;
Field Description
addr
- A
TNetbuf
structure that contains information about an address.- In the
udata
parameter to theOTSndUData
function, this field specifies the location and size of the destination address. You must allocate a buffer to hold the address and initialize theaddr.buf
field to point to that buffer. You must set theaddr.len
field to the length of the address.- In the
udata
parameter to theOTRcvUData
function, on return, this field specifies the location and size of the address of the endpoint that has sent the data. You must allocate a buffer to contain the address, initialize theaddr.buf
field to point to it, and set theaddr.maxlen
field to specify its maximum size.opt
- A
TNetbuf
structure that contains information about options.- In the
udata
parameter to theOTSndUData
function, this field specifies the location and size of options. You must allocate a buffer to hold the options and initialize theopt.buf
field to point to that buffer. You must set theopt.len
field to the length of the options buffer. If you do not want to specify any options, set theopt.len
field to 0.- In the
udata
parameter to theOTRcvUData
function, on return, this field contains any association-related options specified by the endpoint sending data. To read these options, you must allocate a buffer into which the provider can place the options; you must set theopt.buf
field to point to the buffer; and you must set theopt.maxlen
field to the maximum size of the buffer.udata
- A
TNetbuf
structure that contains information about the data being transferred.- In the
udata
parameter to theOTSndUData
function, this field specifies the location and size of the buffer containing the data to be sent. You must allocate a buffer for the data and initialize theudata.buf
field to point to that buffer. You must set theudata.len
field to the size of the data being sent.- If you are sending data that is not stored contiguously, the
udata.buf
field is a pointer to anOTData
structure that describes the first data fragment. In this case, you must set theudata.len
field to the constantkNetbufDataIsOTData
.- In the
udata
parameter to theOTRcvUData
function, this field specifies the location and size of the buffer into which the data being received is going to be placed when the function returns. You must allocate a buffer for the data, set theudata.buf
field to point to it, and set theudata.maxlen
field to the maximum length of this buffer.- If you are doing a no-copy receive, the
udata.buf
field is a pointer to anOTBuffer
pointer. In this case, you must set theudata.maxlen
field to the constantkNetbufDataIsOTBufferStar
.